//异常基类
class HttpException extends Error {
  constructor(message='服务器错误',status=500,code=10000){
    super()
    this.message = message
    this.status = status
    this.code = code
  }
}

//参数异常
class ParameterException extends HttpException {
  constructor(message,code){
    super()
    this.message = message || '参数错误'
    this.code = code || '400'
  }
}
//资源未找到
class NotFound extends HttpException {
  constructor(message,code){
    super()
    this.message = message || '资源未找到'
    this.code = code || '404'
  }
}
//授权失败
class AuthFailed extends HttpException {
  constructor(message,code){
    super()
    this.message = message || '授权失败'
    this.code = code || '401'
  }
}
//禁止访问
class Forbbiden extends HttpException {
  constructor(message,code,status){
    super()
    this.message = message || '禁止访问'
    this.code = code || '403'
    this.status = status || 403
  }
}
module.exports = {
  HttpException,
  ParameterException,
  NotFound,
  AuthFailed,
  Forbbiden,
}